<!--
 * @Author: your name
 * @Date: 2021-09-28 10:33:13
 * @LastEditTime: 2021-09-28 14:38:52
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \xxtx-ui\src\views\components\Home.vue
-->

<template>
  <div>
    <section class="home" id="home">
      <div class="content">
        <h3 style="color:#f52443;">节日庆祝网站平台</h3>
        <span style="color:pink;font-size:25px;">给你的父母，儿子，恋人，朋友一个<span style="color:red;font-size:35px;">surprise</span>吧！</span><br>
        <a href="#" class="btn">contact us</a>
      </div>


    </section>
    <el-carousel :interval="2000" type="card" style="width:140rem;margin:auto;" height="600px">
      <el-carousel-item v-for="(item, index) in img_list" :key="index" style="width:70rem;border-radius: 5rem;">
        <div>
          <img
            :src="item.url"
            alt=""
          />
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
export default {
  data() {
    return {
      img_list: [
        { url: require("../../assets/images/slide-1.jpg") },
        { url: require("../../assets/images/slide-2.jpg") },
        { url: require("../../assets/images/slide-3.jpg") },
        { url: require("../../assets/images/slide-4.jpg") },
        { url: require("../../assets/images/slide-5.jpg") },
        { url: require("../../assets/images/slide-6.jpg") },
      ],
    };
  },
};
let menu = document.querySelector("#menu-bars");
let navbar = document.querySelector(".navbar");

menu.onclick = () => {
  menu.classList.toggle("fa-times");
  navbar.classList.toggle("active");
};

let themeToggler = document.querySelector(".theme-toggler");
let toggleBtn = document.querySelector(".toggle-btn");

toggleBtn.onclick = () => {
  themeToggler.classList.toggle("active");
};

window.onscroll = () => {
  menu.classList.remove("fa-times");
  navbar.classList.remove("active");
  themeToggler.classList.remove("active");
};

document.querySelectorAll(".theme-toggler .theme-btn").forEach((btn) => {
  btn.onclick = () => {
    let color = btn.style.background;
    document.querySelector(":root").style.setProperty("--main-color", color);
  };
});
</script>
<style >

.el-carousel__item div img {
    height:100%;
    width:100%;
    object-fit: cover;
}

.el-carousel__item:nth-child(2n) {
}

.el-carousel__item:nth-child(2n + 1) {
}
.home .content {
  text-align: center;
  padding-top: 6rem;
  margin: 2rem auto;
  max-width: 70rem;
}

.home .content h3 {
  color: #fff;
  font-size: 4.5rem;
  text-transform: uppercase;
}

.home .content h3 span {
  color: var(--main-color);
  text-transform: uppercase;
}

.home .home-slider .swiper-slide {
  overflow: hidden;
  border-radius: 1.5rem;
  height: 50rem;
  width: 35rem;
}

.home .home-slider .swiper-slide img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
</style>